package designMode.structrueMode.bridge;

/**
 * Created by Administrator on 2018/4/11.
 */
public class MyBridge extends Bridge {
    @Override
    public void method() {
        getSourceable().method();
    }

    public static void main(String[] args) {
        Bridge bridge = new MyBridge();

        /*调用第一个对象*/
        Sourceable source1 = new SourceSub1();
        bridge.setSourceable(source1);
        bridge.method();

        /*调用第二个对象*/
        Sourceable source2 = new SourceSub2();
        bridge.setSourceable(source2);
        bridge.method();
    }
}
